<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRecruitmentTable extends Migration{

    public function up(){
        /**
         * 校园招聘会表
         */
        Schema::create('recruitment', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->string('job_title', 100)->default('')->comment('招聘会名称');
            $table->date('hold_time')->index('hold_time')->default('0000-00-00')->comment('举办时间');
            $table->string('hold_pm', 60)->default('')->comment('举办时间(上午,下午,晚上)');
            $table->string('hold_unit', 100)->default('')->comment('举办单位');
            $table->string('hold_address', 200)->default('')->comment('举办地点');
            $table->string('phone', 200)->default('')->comment('联系电话');
            $table->text('job_details')->default('')->comment('招聘会详情');
            $table->text('to_attend')->default('')->comment('参会企业');
            $table->tinyInteger('exhibition')->unsigned()->default(1)->comment('订展类型(1代表开启订展2代表关闭订展)');
            $table->tinyInteger('recruitment_type')->unsigned()->default(0)->comment('招聘会类型(1代表普通招聘2代表校园招聘)');
            $table->string('longitude', 20)->default('')->comment('坐标经度');
            $table->string('latitude', 20)->default('')->comment('坐标纬度');
            $table->timestamps();
        });

        /**
         * 招聘企业报名表
         */
        Schema::create('recruitment_sign_up', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->integer('recruitment_id')->index('recruitment_id')->unsigned()->default(0)->comment('所属招聘会ID');
            $table->integer('com_uid')->index('uid')->unsigned()->default(0)->comment('所属企业用户ID(0代表游客)');
            $table->string('company', 100)->default('')->comment('企业名称');
            $table->string('contact_person', 30)->default('')->comment('联系人');
            $table->string('phone', 100)->default('')->comment('联系电话');
            $table->timestamps();
        });
        /**
         * 招聘广告图片表
         */
        Schema::create('recruitment_ad', function(Blueprint $table){
            $table->engine = 'MyISAM';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->string('sign', 100)->default('')->comment('招聘标签');
            $table->string('pic', 100)->default('')->comment('招聘广告图片');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down(){
        Schema::drop('recruitment');
        Schema::drop('recruitment_sign_up');
        Schema::drop('recruitment_ad');
    }
}
